package com.google.code.stalkernet.async.io;

import java.nio.ByteBuffer;
import java.nio.channels.Channel;
import java.nio.channels.WritableByteChannel;

import com.google.code.stalkernet.async.Async;

/**
 * Asynchronous version of {@link WritableByteChannel} interface.
 *
 * @author Mikhail Vladimirov
 */
public interface AsyncWritableByteChannel extends Async, Channel
{
    /**
     * Asynchronous version of {@link WritableByteChannel#write(ByteBuffer)}.
     *
     * @param src The buffer from which bytes are to be retrieved
     * @param callback callback to receive asynchronous operation result
     * @return asynchronous operation handle
     */
    public Handle write (ByteBuffer src, Callback <Integer> callback);
}
